//
//  ViewController.m
//  MotionLaunchDemo
//
//  Created by 程登伟 on 16/9/14.
//  Copyright © 2016年 程登伟. All rights reserved.
//

#import "ViewController.h"
#import "EGMotionLaunchViewController.h"
#import "EGLineChartViewController.h"

#define SCREENWIDTH [UIScreen mainScreen].bounds.size.width
#define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height


@interface ViewController ()


@end

@implementation ViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self initSubviews];
    
}

-(void)initSubviews{
    
    UIButton *setupMotionLaunch = [UIButton buttonWithType:UIButtonTypeCustom];
    setupMotionLaunch.frame = CGRectMake((SCREENWIDTH - 100)/2.0, 150, 100, 35);
    setupMotionLaunch.layer.cornerRadius = 8;
    setupMotionLaunch.backgroundColor = [UIColor grayColor];
    setupMotionLaunch.titleLabel.font = [UIFont systemFontOfSize:13];
    setupMotionLaunch.layer.masksToBounds = YES;
    [setupMotionLaunch setTitle:@"设置手势密码" forState:UIControlStateNormal];
    [setupMotionLaunch addTarget:self action:@selector(setupMotionAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:setupMotionLaunch];
    
    
    
    UIButton *unLock = [UIButton buttonWithType:UIButtonTypeCustom];
    unLock.frame = CGRectMake((SCREENWIDTH - 100)/2.0, 230, 100, 35);
    unLock.backgroundColor = [UIColor grayColor];
    unLock.titleLabel.font = [UIFont systemFontOfSize:13];
    unLock.layer.cornerRadius = 8;
    unLock.layer.masksToBounds = YES;
    [unLock setTitle:@"解锁" forState:UIControlStateNormal];
    [unLock addTarget:self action:@selector(unLockAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:unLock];
    
    
    UIButton *lineChart = [UIButton buttonWithType:UIButtonTypeCustom];
    lineChart.frame = CGRectMake((SCREENWIDTH - 100)/2.0, 300, 100, 35);
    lineChart.backgroundColor = [UIColor grayColor];
    lineChart.titleLabel.font = [UIFont systemFontOfSize:13];
    lineChart.layer.cornerRadius = 8;
    lineChart.layer.masksToBounds = YES;
    [lineChart setTitle:@"折线图" forState:UIControlStateNormal];
    [lineChart addTarget:self action:@selector(lineChartAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:lineChart];
    
    
}

-(void)setupMotionAction:(UIButton *)button{
    
    EGMotionLaunchViewController *eg = [[EGMotionLaunchViewController alloc] init];
    [self presentViewController:eg animated:YES completion:nil];
}

-(void)unLockAction:(UIButton *)button{
    
}

-(void)lineChartAction:(UIButton *)button{
    
    EGLineChartViewController *lineChart = [[EGLineChartViewController alloc] init];
    [self presentViewController:lineChart animated:YES completion:nil];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
